﻿using MDT.LifeSewagePlatform.Entity;
using Microsoft.EntityFrameworkCore;
using System;
using System.Linq;
using System.Linq.Expressions;
using MDT.LifeSewagePlatform.IRepository;

namespace MDT.LifeSewagePlatform.Repository
{
    public class DetailRepository:BaseRepository<DetailEntity>,IDetailRepository
    {
        public IQueryable<DetailView> GetDetails(Expression<Func<DetailView,bool>> expression)
        {
            return _dbContext.Details.AsNoTracking().
             Select(t => new DetailView()
            {
              Name = t.RowName,
              Desc = t.RowDesc,
              ID = t.ID,
              RowID = t.RowID,
              MainID = t.MainID,
             ParentID = t.ParentID
             }).Where(expression);
        }
    }
}
